package com.mvp.shq.washer.ui.startPage;

import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.mvp.shq.washer.R;
import com.mvp.shq.washer.base.BaseActivity;
import com.mvp.shq.washer.utils.JumpUtil;

public class StartPageActivity extends BaseActivity<Presenter,Model> implements StartPageConstract.View {

    private CountDownTimer timer;
    @Override
    public int getLayoutId() {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //取消状态栏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        return R.layout.activity_start_page;
    }

    @Override
    public void initView() {
        long timeAll = 3*1000;
        long timeSpace = 1000;
        timer = new CountDownTimer(timeAll,timeSpace) {
            @Override
            public void onTick(long millisUntilFinished) {

            }

            @Override
            public void onFinish() {
                JumpUtil.toMain(context);
                finish();
            }
        };
        timer.start();
    }
    @Override
    protected void onDestroy() {
        if (timer != null){
            timer.onFinish();
            timer.cancel();
            timer = null;
        }
        super.onDestroy();
    }
}
